#ifndef __X86_32_ASM_DEFNS_H__
#define __X86_32_ASM_DEFNS_H__
-/* Maybe auto-generate the following two cases (quoted vs. unquoted). */
-#ifndef __ASSEMBLY__
-
-#define __SAVE_ALL_PRE \
- "cld;" \
- "pushl %eax;" \
- "pushl %ebp;" \
- "pushl %edi;" \
- "pushl %esi;" \
- "pushl %edx;" \
- "pushl %ecx;" \
- "pushl %ebx;" \
- "testl $"STR(X86_EFLAGS_VM)","STR(UREGS_eflags)"(%esp);" \
- "jz 2f;" \
- "call setup_vm86_frame;" \
- "jmp 3f;" \
- "2:testb $3,"STR(UREGS_cs)"(%esp);" \
- "jz 1f;" \
- "mov %ds,"STR(UREGS_ds)"(%esp);" \
- "mov %es,"STR(UREGS_es)"(%esp);" \
- "mov %fs,"STR(UREGS_fs)"(%esp);" \
- "mov %gs,"STR(UREGS_gs)"(%esp);" \
- "3:"
-
-#define SAVE_ALL_NOSEGREGS(_reg) \
- __SAVE_ALL_PRE \
- "1:"
-
-#define SET_XEN_SEGMENTS(_reg) \
- "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \
- "mov %e"STR(_reg)"x,%ds;" \
- "mov %e"STR(_reg)"x,%es;"
-
-#define SAVE_ALL(_reg) \
- __SAVE_ALL_PRE \
- SET_XEN_SEGMENTS(_reg) \
- "1:"
-
-#else
-
#define __SAVE_ALL_PRE \
cld; \
pushl %eax; \
pushl %edx; \
pushl %ecx; \
pushl %ebx; \
- testl $X86_EFLAGS_VM,UREGS_eflags(%esp); \
+ testl $(X86_EFLAGS_VM),UREGS_eflags(%esp); \
jz 2f; \
call setup_vm86_frame; \
jmp 3f; \
#define PERFC_INCR(_name,_idx)
#endif
-#endif
-
#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
#define XBUILD_SMP_INTERRUPT(x,v) \
asmlinkage void x(void); \
"\n"__ALIGN_STR"\n" \
STR(x) ":\n\t" \
"pushl $"#v"<<16\n\t" \
- SAVE_ALL(a) \
+ STR(SAVE_ALL(a)) \
"call "STR(smp_##x)"\n\t" \
"jmp ret_from_intr\n");
"\n"__ALIGN_STR"\n" \
STR(x) ":\n\t" \
"pushl $"#v"<<16\n\t" \
- SAVE_ALL(a) \
+ STR(SAVE_ALL(a)) \
"movl %esp,%eax\n\t" \
"pushl %eax\n\t" \
"call "STR(smp_##x)"\n\t" \
__asm__( \
"\n" __ALIGN_STR"\n" \
"common_interrupt:\n\t" \
- SAVE_ALL(a) \
+ STR(SAVE_ALL(a)) \
"movl %esp,%eax\n\t" \
"pushl %eax\n\t" \
"call " STR(do_IRQ) "\n\t" \
#ifndef __X86_64_ASM_DEFNS_H__
#define __X86_64_ASM_DEFNS_H__
-/* Maybe auto-generate the following two cases (quoted vs. unquoted). */
-#ifndef __ASSEMBLY__
-
-#define SAVE_ALL \
- "cld;" \
- "pushq %rdi;" \
- "pushq %rsi;" \
- "pushq %rdx;" \
- "pushq %rcx;" \
- "pushq %rax;" \
- "pushq %r8;" \
- "pushq %r9;" \
- "pushq %r10;" \
- "pushq %r11;" \
- "pushq %rbx;" \
- "pushq %rbp;" \
- "pushq %r12;" \
- "pushq %r13;" \
- "pushq %r14;" \
- "pushq %r15;"
-
-#define RESTORE_ALL \
- "popq %r15;" \
- "popq %r14;" \
- "popq %r13;" \
- "popq %r12;" \
- "popq %rbp;" \
- "popq %rbx;" \
- "popq %r11;" \
- "popq %r10;" \
- "popq %r9;" \
- "popq %r8;" \
- "popq %rax;" \
- "popq %rcx;" \
- "popq %rdx;" \
- "popq %rsi;" \
- "popq %rdi;"
-
-/* Work around AMD erratum #88 */
-#define safe_swapgs \
- "mfence; swapgs;"
-
-#else
-
#define SAVE_ALL \
cld; \
pushq %rdi; \
#define PERFC_INCR(_name,_idx)
#endif
-#endif
+/* Work around AMD erratum #88 */
+#define safe_swapgs \
+ "mfence; swapgs;"
#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
#define XBUILD_SMP_INTERRUPT(x,v) \
STR(x) ":\n\t" \
"pushq $0\n\t" \
"movl $"#v",4(%rsp)\n\t" \
- SAVE_ALL \
+ STR(SAVE_ALL) \
"callq "STR(smp_##x)"\n\t" \
"jmp ret_from_intr\n");
STR(x) ":\n\t" \
"pushq $0\n\t" \
"movl $"#v",4(%rsp)\n\t" \
- SAVE_ALL \
+ STR(SAVE_ALL) \
"movq %rsp,%rdi\n\t" \
"callq "STR(smp_##x)"\n\t" \
"jmp ret_from_intr\n");
__asm__( \
"\n" __ALIGN_STR"\n" \
"common_interrupt:\n\t" \
- SAVE_ALL \
+ STR(SAVE_ALL) \
"movq %rsp,%rdi\n\t" \
"callq " STR(do_IRQ) "\n\t" \
"jmp ret_from_intr\n");